# collections

# 1 集合
print(set(range(10)))

a = {1, 2, 3}
b = {2, 3, 4}
# 并
print(a.union(b))  # {1, 2, 3, 4}
print(a | b)  # {1, 2, 3, 4}

# 交
print(a.intersection(b))  # {2, 3}
print(a & b)  # {2, 3}

# 差
print(a.difference(b))  # {1}
print(a - b)  # {1}

#
print(a.issubset(b))
print(a.issuperset(b))

# 同或
print(a.symmetric_difference(b))  # {1, 4}
print(a ^ b)  # {1, 4}

# 不可变集合
fz = frozenset([1, 2])
print(fz)
for i in fz:
    print(i)  # 1 2
